﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using Microsoft.VisualBasic;

namespace ZK.Qymd_TransManage
{
    public partial class Main : Form
    {

        public Main()
        {
            InitializeComponent();
        }
        

        private void Main_Load(object sender, EventArgs e)
        {
            //AutoSizeFormClass asc = new AutoSizeFormClass();
            //asc.controlAutoSize(this);
            this.WindowState = FormWindowState.Maximized;
            // kryptonLabel1.Text = Login.name;
            SalesRecords sr = new SalesRecords() { TopLevel = false, FormBorderStyle = FormBorderStyle.None };//要添加的Form不显示窗体头和边框
            this.panMain.Controls.Add(sr);
            sr.Show();
        }

        private void picSalesRecords_Click(object sender, EventArgs e)
        {
            picSalesRecords.Image = Properties.Resources.查询_;
            label1.ForeColor = Color.FromArgb(40, 143, 255);
            picManual.Image = Properties.Resources.磅点管理;
            label2.ForeColor = Color.FromArgb(77, 82, 98);
            picSalesSummary.Image = Properties.Resources.汇总统计;
            label3.ForeColor = Color.FromArgb(77, 82, 98);
            picSystemSetup.Image = Properties.Resources.系统设置;
            label4.ForeColor = Color.FromArgb(77, 82, 98);
            this.panMain.Controls.Clear();
            SalesRecords sr = new SalesRecords() { TopLevel = false, FormBorderStyle = FormBorderStyle.None };//要添加的Form不显示窗体头和边框
            this.panMain.Controls.Add(sr);
            sr.Show();
        }

        private void picManual_Click(object sender, EventArgs e)
        {
            picSalesRecords.Image = Properties.Resources.查询;
            label1.ForeColor = Color.FromArgb(77, 82, 98);
            picManual.Image = Properties.Resources.磅点管理_;
            label2.ForeColor = Color.FromArgb(40, 143, 255);
            picSalesSummary.Image = Properties.Resources.汇总统计;
            label3.ForeColor = Color.FromArgb(77, 82, 98);
            picSystemSetup.Image = Properties.Resources.系统设置;
            label4.ForeColor = Color.FromArgb(77, 82, 98);
            
            this.panMain.Controls.Clear();
            ManualPrint mp = new ManualPrint() { TopLevel = false, FormBorderStyle = FormBorderStyle.None };//要添加的Form不显示窗体头和边框
            this.panMain.Controls.Add(mp);
            mp.Show();
        }

        private void picSalesSummary_Click(object sender, EventArgs e)
        {
            picSalesRecords.Image = Properties.Resources.查询;
            label1.ForeColor = Color.FromArgb(77, 82, 98);
            picManual.Image = Properties.Resources.磅点管理;
            label2.ForeColor = Color.FromArgb(77, 82, 98);
            picSalesSummary.Image = Properties.Resources.汇总统计_;
            label3.ForeColor = Color.FromArgb(40, 143, 255);
            picSystemSetup.Image = Properties.Resources.系统设置;
            label4.ForeColor = Color.FromArgb(77, 82, 98);
            this.panMain.Controls.Clear();
            SalesSummary ss = new SalesSummary() { TopLevel = false, FormBorderStyle = FormBorderStyle.None };//要添加的Form不显示窗体头和边框
            this.panMain.Controls.Add(ss);
            ss.Show();
        }

        private void picSystemSetup_Click(object sender, EventArgs e)
        {
            picSalesRecords.Image = Properties.Resources.查询;
            label1.ForeColor = Color.FromArgb(77, 82, 98);
            picManual.Image = Properties.Resources.磅点管理;
            label2.ForeColor = Color.FromArgb(77, 82, 98);
            picSalesSummary.Image = Properties.Resources.汇总统计;
            label3.ForeColor = Color.FromArgb(77, 82, 98);
            picSystemSetup.Image = Properties.Resources.系统设置hover;
            label4.ForeColor = Color.FromArgb(40, 143, 255);
            this.panMain.Controls.Clear();
            string adminPwd = Interaction.InputBox("请输入账号密码", "管理员密码", "", -1, -1);
            if (adminPwd == Login.Psw) {
                UserUpdate update = new UserUpdate() { TopLevel = false, FormBorderStyle = FormBorderStyle.None };//要添加的Form不显示窗体头和边框
                this.panMain.Controls.Add(update);
                update.Show();
            }
        }

        private void Main_SizeChanged(object sender, EventArgs e)
        {
            //AutoSizeFormClass asc = new AutoSizeFormClass();
            //asc.controlAutoSize(this);
        }

        private void Main_FormClosing(object sender, FormClosingEventArgs e)
        {
            Application.Exit();
        }
    }
}
